package org.iks.common;

import lombok.Getter;

/**
 * @author kzou
 * @date 2023/11/18 11:21
 * @description: 统一消息状态码
 */
@Getter
public enum ResultCode {

    /**
     * 成功
     */
    SUCCESS(0, "success"),

    /**
     * 失败
     */
    ERROR(1000, "系统异常"),
    PARAMETER_EXCEPTION(1001, "参数异常"),
    INVALID_MESSAGE(2001, "无效消息"),
    INVALID_SERIAL_TYPE(2002, "无效序列化类型"),
    MESSAGE_SERIAL_EXCEPTION(2003, "消息序列化异常"),
    RPC_EXCEPTION(2004, "RPC 异常"),

    /*----------用户相关异常-------------*/
    USER_ACCOUNT_HAS_EXIST(3001, "账号已存在"),
    USER_ACCOUNT_PASSWORD_ERROR(3002, "账号或密码错误"),
    USER_LOGIN_ERROR(3003, "登录异常"),
    LOGIN_OFFLINE(3004, "登录失效"),
    USER_ACCOUNT_NOT_EXIST(3005, "账号不存在"),
    RPT_ERROR(4001, "RPC异常"),
    USER_OFFLINE(4002, "用户已下线"),
    NOT_AUTHORITY(4003, "没有权限"),
    ;

    /**
     * 状态码说明消息
     */
    private final String message;

    /**
     * 状态码
     */
    private final int code;


    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
